package pers.zb.cloud.service.upms.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pers.zb.cloud.service.upms.dao.RoleClientPermissionMapper;
import pers.zb.cloud.service.upms.entity.SysRoleClientPermission;
import pers.zb.cloud.service.upms.service.RoleClientPermissionService;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service("roleClientPermissionServiceImpl")
public class RoleClientPermissionServiceImpl extends BaseServiceImpl<SysRoleClientPermission> implements RoleClientPermissionService {

    @Autowired
    private RoleClientPermissionMapper roleClientPermissionMapper;

    @Override
    public List<SysRoleClientPermission> getHaveAccessPermissionByRolesAndClients(List<Long> userRoleList, List<String> roleClientList) {
        Example example = new Example(SysRoleClientPermission.class);
        example.createCriteria().andIn("roleId",userRoleList).andIn("clientId",roleClientList);
        List<SysRoleClientPermission> roleClientPermissionList = roleClientPermissionMapper.selectByExample(example);
        return roleClientPermissionList;
    }
}
